package com.albaba.designpattern.prototype.text_001;

/**
 * @author zx
 * @version 1.0
 * @description TODO
 * @date 2025/2/19 21:56
 */
public class TextPrototype_001 {

    public static void main(String[] args) throws CloneNotSupportedException {
        // ConcretePrototype prototype = new ConcretePrototype();
        // ConcretePrototype clone = prototype.clone();
        // System.out.println(prototype == clone);

        ConcretePrototype prototype = new ConcretePrototype();
        Person person = new Person("张三");
        prototype.setPerson(person);
        // 复制
        ConcretePrototype clone = prototype.clone();
        Person person1 = clone.getPerson();
        person1.setName("李四");

        clone.show();
        prototype.show();

        System.out.println(person1 == person);
    }
}
